/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = activemq_openwire_parse.c                          */
/*  NOTE      =                                                    */
/*  DATE      = 2015/04/28 by geyh                                 */
/*******************************************************************/
#include <stdio.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"
#include "activemq_base_type.h"
#include "activemq_common.h"
#include "activemq_openwire_parse.h"
#include "frreport_comm.h"

/*******************************************************************************
*  FUNC     :  从bytebuff中获取object的broker_id 添加到链表当中
*  ARGS     :  p_st_data                   输入力数据
*           :  p_st_body_data                上报链表
*           :  p_i_index                   节点的索引号
*           :  i_flag_tightmarshal         数据是否用tightmarshal（FR_YES   FR_NO）
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     false
*  NOTE     :
*******************************************************************************/
int get_peerbroker_info(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, ACTIVEMQ_boolean *p_st_boolean, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    short s_size = 0;

    if(p_st_data == NULL || p_st_body_data == NULL || p_st_private == NULL)
        return FR_FAIL;

    //peerbroker != NULL
    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
    if(i_ret < 0)
        return FR_FAIL;

    if(i_ret)
    {
        i_ret = bytebuff_get_short(p_st_data, 2, (uint16_t *)&s_size, BYTE_BIG_ENDIAN);
        if(i_ret == FR_FAIL)
            return FR_FAIL;

        while(s_size)
        {
            i_ret = openwire_brokerinfo_tightUnmarshal(p_st_data, p_st_body_data, p_st_private);
            if(i_ret == FR_FAIL)
                return FR_FAIL;

            s_size--;
        }
    }

    return FR_SUCC;

}

/*******************************************************************************
*  FUNC     :  openwire wireinfo 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*           :  ui_data_len                 object wireinfo length
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_wireinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, unsigned int ui_data_len, L7session_activeMQ_private *p_st_private)
{
    unsigned int ui_leftlen = 0,  ui_pos = 0;
    unsigned char uc_boolean = 0x00;
    int i_mapsize = 0;
    int i_ret = 0, i_field_value = 0, i_ret_data = 0;
    unsigned short us_field_len = 0;
    char *p_field_name = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL || p_st_private == NULL)
        return FR_FAIL;

    //获取bytebuff长度

    ui_leftlen = bytebuff_remaining(p_st_data);
    if(ui_leftlen != ui_data_len)
        return FR_FAIL;

    //magic 8位
    if(ui_leftlen < 8)
        return FR_FAIL;
    //分配内存
//    i_ret = frreport_body_l7_add_str(p_st_body_data, "magic", "ActiveMQ");
//    if(i_ret == FR_FAIL)
//        return FR_FAIL;
    if(p_st_private->p_server == NULL)
    {
        p_st_private->p_server = frstrdup("ActiveMQ");
        if(p_st_private->p_server == NULL)
            return FR_FAIL;
    }

    ui_leftlen -= 8;
    bytebuff_skip(p_st_data, 8);

    //version
    if(ui_leftlen<4)
        return FR_FAIL;

    i_ret = bytebuff_get_int(p_st_data, 4, (uint32_t *)&i_field_value, BYTE_BIG_ENDIAN);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

//    i_ret = frreport_body_l7_add_int(p_st_body_data, "version", i_field_value);
//    if(i_ret == FR_FAIL)
//        return FR_FAIL;

    //wireformat 交互
    if(p_st_private->i_openwire_version == 0)
        p_st_private->i_openwire_version = i_field_value;
    else if(p_st_private->i_openwire_version > i_field_value)
        p_st_private->i_openwire_version = i_field_value;

    ui_leftlen -= 4;

    if(ui_leftlen < 1)
        return FR_FAIL;

    //data 00 结束
    bytebuff_get_char(p_st_data, &uc_boolean);
    if(!(uc_boolean & 0x01))
        return FR_SUCC;
    ui_leftlen --;

    if(ui_leftlen < 4)
        return FR_FAIL;
    //ui_data_len  判断长度是否相等
    i_ret = bytebuff_get_int(p_st_data, 4, &ui_data_len, BYTE_BIG_ENDIAN);
    if(i_ret == FR_FAIL)
        return FR_FAIL;
    ui_leftlen -= 4;
    if(ui_leftlen != ui_data_len)
        return FR_FAIL;

    if(ui_leftlen<4)
        return FR_FAIL;

    //map size
    i_ret = bytebuff_get_int(p_st_data, 4, (uint32_t *)&i_mapsize, BYTE_BIG_ENDIAN);
    if(i_ret == FR_FAIL)
        return FR_FAIL;
    ui_leftlen-=4;

    //循环读取map data
    while(i_mapsize != 0 )
    {
        //获取字段名长度
        i_ret = bytebuff_get_short(p_st_data, 2, &us_field_len, BYTE_BIG_ENDIAN);
        if(i_ret == FR_FAIL)
            return FR_FAIL;
        ui_leftlen -= 2;

        //分配内存
        //p_field_name
        p_field_name = (char *)frmalloc(us_field_len + 1);
        if(p_field_name == NULL)
            return FR_FAIL;

        ui_pos = bytebuff_getPosition(p_st_data);

        i_ret = bytebuff_get_bytes(p_st_data, p_field_name, us_field_len);
        if(i_ret == FR_FAIL)
        {
            frfree(p_field_name);
            return FR_FAIL;
        }
        p_field_name[us_field_len] = '\0';
        ui_leftlen -= us_field_len;

        //获取value
        i_ret = activeMQ_get_data(p_st_data, p_st_body_data, p_field_name, &i_ret_data);
        if(i_ret == FR_FAIL)
        {
            frfree(p_field_name);
            return FR_FAIL;
        }

        if(strcasecmp(p_field_name,"TightEncodingEnabled") == 0 && i_ret_data == 0)
             p_st_private->i_tightEncodingEnabled = i_ret_data;
        else if(strcasecmp(p_field_name,"CacheEnabled") == 0 && i_ret_data == 0)
             p_st_private->i_cacheEnabled = i_ret_data;

        frfree(p_field_name);
        p_field_name = NULL;
        i_mapsize--;
    }

    p_st_private->i_flag_try = 0;
    return FR_SUCC;

}


/*******************************************************************************
*  FUNC     :  openwire brokerinfo 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_brokerinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

//if wireFormat.isCacheEnabled
    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//
//    //broker id
//    i_ret = get_broker_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //broker url
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "brokerurl", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //PeerBrokerInfos != NULL
//    i_ret = get_peerbroker_info(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //broker name
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "brokername", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isSlaveBroker
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isslavebroker", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isMasterBroker
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "ismasterbroker", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isFaultTolerantConfiguration
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isfaulttolerantconfiguration", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isDuplexConnection
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isduplexconnection", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isNetworkConnection
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isnetworkconnection", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //ConnectionId
//    i_ret = activeMQ_get_long(p_st_data, p_st_boolean, p_st_body_data, "connectionid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//    //BrokerUploadUrl
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "brokeruploadurl", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //NetworkProperties
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "networkproperties", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire connection info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_connectioninfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
//    short s_brokerpath_size = 0;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//if wireFormat.isCacheEnabled
    //connection id
    i_ret = get_connection_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //client ID
    i_ret = activeMQ_skip_string(p_st_data, p_st_boolean);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //PASSWORD
    i_ret = activeMQ_get_pass(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //USERNAME
    i_ret = activeMQ_get_user(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

    //存储到session

//    //BrokerPath != NULL
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret)
//    {
//        i_ret = bytebuff_get_short(p_st_data, 2, (uint16_t *)&s_brokerpath_size, BYTE_BIG_ENDIAN);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//        //获取broker id  tightmarshal
//        while(s_brokerpath_size)
//        {
//            i_ret = get_broker_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//            if(i_ret == FR_FAIL)
//                goto ERROR;
//        }
//    }

//    //isSlaveBroker
//    i_ret = activeMQ_skip_boolean(p_st_data, p_st_boolean, p_st_body_data, "isbrokermasterconnector", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isMasterBroker
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "ismanageable", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isFaultTolerantConfiguration
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isclientmaster", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isDuplexConnection
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isfaulttolerant", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isNetworkConnection
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isfailoverreconnect", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //NetworkProperties
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "clientip", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    if(p_st_boolean)
//    {
//        if(p_st_boolean->p_boolean_data)
//            frfree(p_st_boolean->p_boolean_data);
//
//        frfree(p_st_boolean);
//    }
//
//    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire session info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_sessioninfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

////if wireFormat.isCacheEnabled
//    //session id
//    i_ret = get_session_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire consumer info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_consumerinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
//    short s_path_size = 0;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//if wireFormat.isCacheEnabled
    //consumer id
    i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isBrowser
    i_ret = activeMQ_skip_boolean(p_st_data, p_st_boolean);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination   PhysicalName
    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    i_ret = frreport_body_l7_add_str(p_st_body_data, "subscription.mq.topic", p_st_private->p_title);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

//
//    // PrefetchSize
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "prefetchsize", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//

//    //MaximumPendingMessageLimit
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "maximumpendingmessagelimit", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//

//    //isDispatchAsync
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isdispatchasync", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//

//    //Selector
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "selector", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//



//    //ClientId
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "clientid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//


//    //SubscriptionName
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "subscriptionname", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

//    //isNoLocal
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isnolocal", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isExclusive
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isexclusive", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//

//    //isRetroactive
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isretroactive", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//

//    //Priority
//    i_ret = activeMQ_get_byte(p_st_data, p_st_body_data, "priority", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //BrokerPath != NULL
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret)
//    {
//        i_ret = bytebuff_get_short(p_st_data, 2, (uint16_t *)&s_path_size, BYTE_BIG_ENDIAN);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//        //获取broker id  tightmarshal
//        while(s_path_size)
//        {
//            i_ret = get_broker_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//            if(i_ret == FR_FAIL)
//                goto ERROR;
//        }
//    }
//    //AdditionalPredicate
//    //o != null
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret == 1)
//    {
//        i_ret = activeMQ_get_byte(p_st_data, p_st_body_data, "additionalpredicate", p_st_private->i_use_request);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//    }
//
//    //isNetworkSubscription
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isnetworksubscription", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isOptimizedAcknowledge
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isoptimizedacknowledge", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isNoRangeAcks
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isnorangeacks", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //NetworkConsumerPath
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret)
//    {
//        i_ret = bytebuff_get_short(p_st_data, 2, (uint16_t *)&s_path_size, BYTE_BIG_ENDIAN);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//        //获取broker id  tightmarshal
//        while(s_path_size)
//        {
//            i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//            if(i_ret == FR_FAIL)
//                goto ERROR;
//        }
//    }

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire consumer info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_producerinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
//    short s_path_size = 0;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//if wireFormat.isCacheEnabled
    //producer id
    i_ret = skip_producer_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination
    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //BrokerPath != NULL
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret)
//    {
//        i_ret = bytebuff_get_short(p_st_data, 2, (uint16_t *)&s_path_size, BYTE_BIG_ENDIAN);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//        //获取broker id  tightmarshal
//        while(s_path_size)
//        {
//            i_ret = get_broker_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//            if(i_ret == FR_FAIL)
//                goto ERROR;
//        }
//    }
//
//    //isDispatchAsync
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isdispatchasync", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //WindowSize
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "windowsize", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }
    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire producerack info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_producerack_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

////if wireFormat.isCacheEnabled
//    //producer id
//    i_ret = get_producer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //Size
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "size", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire transaction info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_transactioninfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

////if wireFormat.isCacheEnabled
//    //connection id
//    i_ret = get_connection_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //local_transaction_id
//    i_ret = get_local_transaction_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //type
//    i_ret = activeMQ_get_byte(p_st_data, p_st_body_data, "type", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire keepalive info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_keepaliveinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire shotdown info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_shutdowninfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}




/*******************************************************************************
*  FUNC     :  openwire remove info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_removeinfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //get_object_id
//    i_ret = get_object_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //LastDeliveredSequenceId
//    i_ret = activeMQ_get_long(p_st_data, p_st_boolean, p_st_body_data, "lastdeliveredsequenceid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        return FR_FAIL;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire removesubscription info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_removesubscriptioninfo_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //get_connection_id
//    i_ret = get_connection_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //SubcriptionName
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "subcriptionname", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //ClientId
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "clientid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire controlcommand info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_controlcommand_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //Command
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "command", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}



/*******************************************************************************
*  FUNC     :  openwire flushcommand info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_flushcommand_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire connectionerror info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_connectionerror_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Exception
//    i_ret = activeMQ_get_throwable(p_st_data, p_st_body_data, p_st_boolean, p_st_private, 0);
//    if(i_ret == FR_FAIL)
//    {
//        i_ret = activeMQ_get_throwable(p_st_data, p_st_body_data, p_st_boolean, p_st_private, 1);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//    }
//
//    //ConnectionId
//    i_ret = get_connection_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire consumercontrol info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_consumercontrol_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //Destination
//    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isClose
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isclose", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //ConsumerId
//    i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //Prefetch
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "prefetch", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isFlush
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isflush", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isStart
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isstart", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isStop
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isstop", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire connectioncontrol info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_connectioncontrol_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //isClose
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isclose", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isExit
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isexit", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isFaultTolerant
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isfaulttolerant", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isResume
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isresume", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isSuspend
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "issuspend", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //ConnectedBrokers url
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "connectedbrokers", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //broker ReconnectTo
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "reconnectto", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //isRebalanceConnection
//    i_ret = activeMQ_get_boolean(p_st_data, p_st_boolean, p_st_body_data, "isrebalanceconnection", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //Token
//    i_ret = activeMQ_get_bytes(p_st_data, p_st_boolean, p_st_body_data, "token", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire messagedispatch info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_messagedispatch_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
    char c_mess_type;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //consumer id
    i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination   PhysicalName
    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Message
    //object != NULL
    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
    if(i_ret < 0)
        goto ERROR;

    if(i_ret)
    {
        //isMarshallAware
        //sequence != NULL
        i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
        if(i_ret < 0 || i_ret == 1)
            goto ERROR;

        //todo 判断是否为message
        i_ret = bytebuff_get_char(p_st_data, (uint8_t *)&c_mess_type);
        if(i_ret == FR_FAIL)
            goto ERROR;

        switch (c_mess_type)
        {
            case ACTIVEMQ_ACTIVEMQ_TEXT_MESSAGE:
                p_st_private->i_message_type = 2;
                break;

            case ACTIVEMQ_ACTIVEMQ_MAP_MESSAGE:
                p_st_private->i_message_type = 1;
                break;

            case ACTIVEMQ_ACTIVEMQ_BYTES_MESSAGE:
            case ACTIVEMQ_ACTIVEMQ_OBJECT_MESSAGE:
            case ACTIVEMQ_ACTIVEMQ_STREAM_MESSAGE:
            case ACTIVEMQ_ACTIVEMQ_BLOB_MESSAGE:
                p_st_private->i_message_type = 3;
                break;

            default:
                goto ERROR;
        }

        i_ret = get_activemq_message(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
        if(i_ret == FR_FAIL)
            goto ERROR;

    }


    //RedeliveryCounter
    i_ret = bytebuff_skip(p_st_data, 4);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    if(p_st_data->ui_remaining )
        return FR_FAIL;

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}



/*******************************************************************************
*  FUNC     :  openwire messagedispatch info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_map_message_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    p_st_private->i_message_type = 1;

    i_ret = get_activemq_message(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    if(p_st_data->ui_remaining)
        return FR_FAIL;

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire messagedispatch info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_text_message_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    p_st_private->i_message_type = 2;

    i_ret = get_activemq_message(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    if(p_st_data->ui_remaining)
        return FR_FAIL;

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}



/*******************************************************************************
*  FUNC     :  openwire messagedispatch info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_stream_message_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    p_st_private->i_message_type = 3;

    i_ret = get_activemq_message(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    if(p_st_data->ui_remaining )
        return FR_FAIL;

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire messagepull 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_messagepull_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;
//
//    //consumer id
//    i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //Destination   PhysicalName
//    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //Timeout
//    i_ret = activeMQ_get_long(p_st_data, p_st_boolean, p_st_body_data, "timeout", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //CorrelationId
//    i_ret = activeMQ_get_string(p_st_data, p_st_boolean, p_st_body_data, "correlationid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;
//
//    //get_message_id
//    i_ret = get_message_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}

/*******************************************************************************
*  FUNC     :  openwire messageack 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_messageack_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination   PhysicalName
    i_ret = get_destination(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //get_transaction_id
    i_ret = skip_transaction_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //consumer id
    i_ret = get_consumer_id(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //AckType
//    i_ret = activeMQ_get_byte(p_st_data, p_st_body_data, "acktype", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    i_ret = bytebuff_skip(p_st_data, 1);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //get_message_id first
    i_ret = skip_message_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //get_message_id last
    i_ret = skip_message_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //MessageCount
//    i_ret = activeMQ_skip_int(p_st_data, p_st_boolean);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    i_ret = bytebuff_skip(p_st_data, 4);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //PoisonCause
    i_ret = activeMQ_skip_throwable(p_st_data, p_st_boolean, p_st_private, 0);
    if(i_ret == FR_FAIL)
    {
        i_ret = activeMQ_skip_throwable(p_st_data, p_st_boolean, p_st_private, 1);
        if(i_ret == FR_FAIL)
            goto ERROR;
    }

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire messagedispatch info 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_response_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //CorrelationId
//    i_ret = activeMQ_get_int(p_st_data, p_st_body_data, "correlationid", p_st_private->i_use_request);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;

}


/*******************************************************************************
*  FUNC     :  openwire exceptionresponse 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_exceptionresponse_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //Exception
//    i_ret = activeMQ_get_throwable(p_st_data, p_st_body_data, p_st_boolean, p_st_private, 0);
//    if(i_ret == FR_FAIL)
//    {
//        i_ret = activeMQ_get_throwable(p_st_data, p_st_body_data, p_st_boolean, p_st_private, 1);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//    }

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;

}


/*******************************************************************************
*  FUNC     :  只取commandID responserequired 解析
*  ARGS     :  p_st_data                   解析数据
*           :  p_st_body_data                上报链表
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_tightUnmarshal(Frbyte_Packet *p_st_data, Frreport_body_data *p_st_body_data, L7session_activeMQ_private *p_st_private)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;

    if(p_st_data == NULL || p_st_body_data == NULL ||  p_st_private == NULL)
        return FR_FAIL;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //command id
    i_ret = activeMQ_get_command_id(p_st_data, p_st_body_data);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //isResponseRequired
    i_ret = get_response_required(p_st_data, p_st_boolean, p_st_body_data, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    return FR_FAIL;

}


/*******************************************************************************
*  FUNC     :  openwire messageack 解析
*  ARGS     :  p_st_data                   解析数据
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_messageack_tightUnmarshal_detect(Frbyte_Packet *p_st_data, int i_tightEncodingEnabled, int i_cacheEnabled, int i_openwire_version)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
    L7session_activeMQ_private *p_st_private = NULL;

    if(p_st_data == NULL)
        return FR_FAIL;

    p_st_private = (L7session_activeMQ_private*)frmalloc(sizeof(L7session_activeMQ_private));
    if(p_st_private == NULL)
        return FR_FAIL;
    
    p_st_private->i_tightEncodingEnabled = i_tightEncodingEnabled;
    p_st_private->i_cacheEnabled = i_cacheEnabled;
    p_st_private->i_openwire_version = i_openwire_version;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    i_ret = bytebuff_skip(p_st_data, 4);
    if(i_ret == FR_FAIL)
        goto ERROR;

    i_ret = activeMQ_skip_boolean(p_st_data, p_st_boolean);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination   PhysicalName
    i_ret = skip_destination(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //get_transaction_id
    i_ret = skip_transaction_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //consumer id
    i_ret = skip_consumer_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //AckType
    i_ret = bytebuff_skip(p_st_data, 1);
    if(i_ret == FR_FAIL)
        return FR_FAIL;

    //get_message_id first
    i_ret = skip_message_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //get_message_id last
    i_ret = skip_message_id(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //MessageCount
    i_ret = bytebuff_skip(p_st_data, 4);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //PoisonCause
    i_ret = activeMQ_skip_throwable(p_st_data, p_st_boolean, p_st_private, 0);
    if(i_ret == FR_FAIL)
    {
        i_ret = activeMQ_skip_throwable(p_st_data, p_st_boolean, p_st_private, 1);
        if(i_ret == FR_FAIL)
            goto ERROR;
    }

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    frfree(p_st_private);

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    frfree(p_st_private);

    return FR_FAIL;
}


/*******************************************************************************
*  FUNC     :  openwire messageack 解析
*  ARGS     :  p_st_data                   解析数据
*  RTN      :  FR_FAIL                     失败
*           :  FR_SUCC                     成功
*  NOTE     :
*******************************************************************************/
int openwire_messagedispatch_tightUnmarshal_detect(Frbyte_Packet *p_st_data, int i_tightEncodingEnabled, int i_cacheEnabled, int i_openwire_version)
{
    int i_ret = 0;
    ACTIVEMQ_boolean *p_st_boolean = NULL;
    L7session_activeMQ_private *p_st_private = NULL;

    if(p_st_data == NULL)
        return FR_FAIL;

    p_st_private = (L7session_activeMQ_private*)frmalloc(sizeof(L7session_activeMQ_private));
    if(p_st_private == NULL)
        return FR_FAIL;

    p_st_private->i_tightEncodingEnabled = i_tightEncodingEnabled;
    p_st_private->i_cacheEnabled = i_cacheEnabled;
    p_st_private->i_openwire_version = i_openwire_version;

    i_ret = activeMQ_boolean_stream_get(p_st_data, &p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

    i_ret = bytebuff_skip(p_st_data, 4);
    if(i_ret == FR_FAIL)
        goto ERROR;

    i_ret = activeMQ_skip_boolean(p_st_data, p_st_boolean);
    if(i_ret == FR_FAIL)
        goto ERROR;

    //Destination   PhysicalName
    i_ret = skip_destination(p_st_data, p_st_boolean, p_st_private);
    if(i_ret == FR_FAIL)
        goto ERROR;

//    //Message
//    //object != NULL
//    i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//    if(i_ret < 0)
//        goto ERROR;
//
//    if(i_ret)
//    {
//        if(p_st_private->i_tightEncodingEnabled)
//        {
//            //isMarshallAware
//            //sequence != NULL
//            i_ret = activeMQ_boolean_stream_parse(p_st_data, p_st_boolean);
//            if(i_ret < 0 || i_ret == 1)
//                goto ERROR;
//
//        }
//
//        bytebuff_skip(p_st_data, 1);
//        i_ret = get_activemq_message(p_st_data, p_st_body_data, p_st_boolean, p_st_private);
//        if(i_ret == FR_FAIL)
//            goto ERROR;
//
//    }
//
//
//    //RedeliveryCounter
//    i_ret = bytebuff_skip(p_st_data, 4);
//    if(i_ret == FR_FAIL)
//        goto ERROR;

    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    frfree(p_st_private);

    return FR_SUCC;

ERROR:
    if(p_st_boolean)
    {
        if(p_st_boolean->p_boolean_data)
            frfree(p_st_boolean->p_boolean_data);

        frfree(p_st_boolean);
    }

    frfree(p_st_private);

    return FR_FAIL;
}
